package main

import (
	"fmt"
	"regexp"
)

const text = `
My email is ccmouse@gmail.com
email1 is abc@def.org
email2 is   kkk@qq.com
email3 is   ddd@abc.com.cn
`
const text1 = `
<div class="m-btn purple" data-v-8b1eac0c>离异</div><div class="m-btn purple" data-v-8b1eac0c>44岁</div>
`

func main() {
	re := regexp.MustCompile(`([a-zA-Z0-9]+)@([a-zA-Z0-9]+)(\.[a-zA-Z.]+)`) // 构建正则表达式
	//match := re.FindString(text)  // 匹配单一字符串
	//match := re.FindAllString(text, -1)  // 匹配所有的字符串
	match := re.FindAllStringSubmatch(text, -1) // 匹配所有的子匹配字符串(括号里的)
	for _, m := range match {
		fmt.Println(m)
	}
	//fmt.Println(match)
}
